package com.example.dllo.my36kr.my;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

import com.example.dllo.my36kr.R;

/**
 * Created by dllo on 16/8/20.
 */
public class MyPopupWindow extends PopupWindow {
    Context mContext;



    public MyPopupWindow(Activity context, View.OnClickListener itemsOnClick) {
        super(context);
        this.mContext = context;
        View view = LayoutInflater.from(context).inflate(R.layout.window_my,null);
        Button quxiao = (Button) view.findViewById(R.id.bnt_window_quxiao);
        quxiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        Button call = (Button) view.findViewById(R.id.bnt_my_call);
        call.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intentPhone = new Intent();
                intentPhone.setAction(Intent.ACTION_CALL);
                Uri uri = Uri.parse("tel:" + "4009953636");
                intentPhone.setData(uri);
                mContext.startActivity(intentPhone);
            }
        });

        this.setContentView(view);
        this.setWidth(LinearLayout.LayoutParams.FILL_PARENT);
        //设置SelectPicPopupWindow弹出窗体的高
        this.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
        //设置SelectPicPopupWindow弹出窗体可点击
        this.setFocusable(true);
        ColorDrawable dw = new ColorDrawable(0xb0000000);
        this.setBackgroundDrawable(dw);
        view.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return false;
            }
        });

    }
}
